# -*- mode: python; -*-

import os
Import('BuildEnv')
env = BuildEnv.Clone()

sources = [
    'MANIFEST.in',
    'setup.py'
    ]

setup_sources_rules = []
for file in sources:
    setup_sources_rules.append(env.Install("", "#controller/src/server-manager/monitoring/ipmi/" + file))

sources += env.SandeshGenPy(
    'monitoring.sandesh',
    'contrail_sm_monitoring/', False)

MonitoringDocFiles = []
MonitoringDocFiles += env.SandeshGenDoc('monitoring.sandesh')

cd_cmd = 'cd ' + Dir('.').path + ' && '
if 'install_contrail_sm_monitoring' in BUILD_TARGETS:
    install_cmd = env.Command(None, sources,
                              cd_cmd + 'python setup.py install %s' %
                              env['PYTHON_INSTALL_OPT'])
    env.Alias('install_contrail_sm_monitoring', install_cmd)
    env.Alias('install', env.Install(
        env['INSTALL_MESSAGE_DOC'] + '/contrail-sm-monitoring/',
        MonitoringDocFiles))
